<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>OpenLoong Dynamics Control: MPC Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">OpenLoong Dynamics Control
   &#160;<span id="projectnumber">v0.1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classMPC-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">MPC Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>This class implements the model predictive controller.  
 <a href="classMPC.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="mpc_8h_source.html">mpc.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:af4e2bb7c17925152b578a24b3d8f3791"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMPC.html#af4e2bb7c17925152b578a24b3d8f3791">MPC</a> (double dtIn)</td></tr>
<tr class="memdesc:af4e2bb7c17925152b578a24b3d8f3791"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct a new <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> object.  <a href="classMPC.html#af4e2bb7c17925152b578a24b3d8f3791">More...</a><br /></td></tr>
<tr class="separator:af4e2bb7c17925152b578a24b3d8f3791"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a41574ac96dfd97c389bb6f9c1de01c06"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMPC.html#a41574ac96dfd97c389bb6f9c1de01c06">set_weight</a> (double u_weight, Eigen::MatrixXd L_diag, Eigen::MatrixXd K_diag)</td></tr>
<tr class="memdesc:a41574ac96dfd97c389bb6f9c1de01c06"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the weight of cost function.  <a href="classMPC.html#a41574ac96dfd97c389bb6f9c1de01c06">More...</a><br /></td></tr>
<tr class="separator:a41574ac96dfd97c389bb6f9c1de01c06"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a618d7e191ba58809e20dc03cc790dbe4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMPC.html#a618d7e191ba58809e20dc03cc790dbe4">cal</a> ()</td></tr>
<tr class="memdesc:a618d7e191ba58809e20dc03cc790dbe4"><td class="mdescLeft">&#160;</td><td class="mdescRight">run <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a>  <a href="classMPC.html#a618d7e191ba58809e20dc03cc790dbe4">More...</a><br /></td></tr>
<tr class="separator:a618d7e191ba58809e20dc03cc790dbe4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0e37e446706cbf8d8f6de14377423d9d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMPC.html#a0e37e446706cbf8d8f6de14377423d9d">dataBusRead</a> (<a class="el" href="structDataBus.html">DataBus</a> &amp;Data)</td></tr>
<tr class="memdesc:a0e37e446706cbf8d8f6de14377423d9d"><td class="mdescLeft">&#160;</td><td class="mdescRight">read data from data bus  <a href="classMPC.html#a0e37e446706cbf8d8f6de14377423d9d">More...</a><br /></td></tr>
<tr class="separator:a0e37e446706cbf8d8f6de14377423d9d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a81bff1debd03ea83a56c85da5a70caf9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMPC.html#a81bff1debd03ea83a56c85da5a70caf9">dataBusWrite</a> (<a class="el" href="structDataBus.html">DataBus</a> &amp;Data)</td></tr>
<tr class="memdesc:a81bff1debd03ea83a56c85da5a70caf9"><td class="mdescLeft">&#160;</td><td class="mdescRight">write date to data bus  <a href="classMPC.html#a81bff1debd03ea83a56c85da5a70caf9">More...</a><br /></td></tr>
<tr class="separator:a81bff1debd03ea83a56c85da5a70caf9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a01dcc1140862fcb030153849a9cb3ff9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMPC.html#a01dcc1140862fcb030153849a9cb3ff9">enable</a> ()</td></tr>
<tr class="memdesc:a01dcc1140862fcb030153849a9cb3ff9"><td class="mdescLeft">&#160;</td><td class="mdescRight">enable <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> calculation  <a href="classMPC.html#a01dcc1140862fcb030153849a9cb3ff9">More...</a><br /></td></tr>
<tr class="separator:a01dcc1140862fcb030153849a9cb3ff9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a39bcff9265cd0e14857c190cf42c418c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMPC.html#a39bcff9265cd0e14857c190cf42c418c">disable</a> ()</td></tr>
<tr class="memdesc:a39bcff9265cd0e14857c190cf42c418c"><td class="mdescLeft">&#160;</td><td class="mdescRight">disable <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> calculation  <a href="classMPC.html#a39bcff9265cd0e14857c190cf42c418c">More...</a><br /></td></tr>
<tr class="separator:a39bcff9265cd0e14857c190cf42c418c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a23fc46fc8d12f89adad3c19035f93579"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMPC.html#a23fc46fc8d12f89adad3c19035f93579">get_ENA</a> ()</td></tr>
<tr class="memdesc:a23fc46fc8d12f89adad3c19035f93579"><td class="mdescLeft">&#160;</td><td class="mdescRight">get current <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> enable state  <a href="classMPC.html#a23fc46fc8d12f89adad3c19035f93579">More...</a><br /></td></tr>
<tr class="separator:a23fc46fc8d12f89adad3c19035f93579"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This class implements the model predictive controller. </p>

<p class="definition">Definition at line <a class="el" href="mpc_8h_source.html#l00036">36</a> of file <a class="el" href="mpc_8h_source.html">mpc.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="af4e2bb7c17925152b578a24b3d8f3791"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af4e2bb7c17925152b578a24b3d8f3791">&#9670;&nbsp;</a></span>MPC()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">MPC::MPC </td>
          <td>(</td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>dtIn</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Construct a new <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> object. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dtIn</td><td><a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> control frequency </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="mpc_8cpp_source.html#l00012">12</a> of file <a class="el" href="mpc_8cpp_source.html">mpc.cpp</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a618d7e191ba58809e20dc03cc790dbe4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a618d7e191ba58809e20dc03cc790dbe4">&#9670;&nbsp;</a></span>cal()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void MPC::cal </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>run <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> </p>
<p>calculte the desired ground reaction force and moment </p>

<p class="definition">Definition at line <a class="el" href="mpc_8cpp_source.html#l00167">167</a> of file <a class="el" href="mpc_8cpp_source.html">mpc.cpp</a>.</p>

<p class="reference">References <a class="el" href="data__bus_8h_source.html#l00168">DataBus::DSt</a>, and <a class="el" href="data__bus_8h_source.html#l00166">DataBus::LSt</a>.</p>

</div>
</div>
<a id="a0e37e446706cbf8d8f6de14377423d9d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0e37e446706cbf8d8f6de14377423d9d">&#9670;&nbsp;</a></span>dataBusRead()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void MPC::dataBusRead </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structDataBus.html">DataBus</a> &amp;&#160;</td>
          <td class="paramname"><em>Data</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>read data from data bus </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Data</td><td></td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="mpc_8cpp_source.html#l00088">88</a> of file <a class="el" href="mpc_8cpp_source.html">mpc.cpp</a>.</p>

<p class="reference">References <a class="el" href="data__bus_8h_source.html#l00102">DataBus::base_omega_W</a>, <a class="el" href="data__bus_8h_source.html#l00066">DataBus::base_pos</a>, <a class="el" href="data__bus_8h_source.html#l00069">DataBus::base_rot</a>, <a class="el" href="data__bus_8h_source.html#l00103">DataBus::base_rpy</a>, <a class="el" href="data__bus_8h_source.html#l00051">DataBus::dq</a>, <a class="el" href="data__bus_8h_source.html#l00065">DataBus::fe_l_pos_W</a>, <a class="el" href="data__bus_8h_source.html#l00068">DataBus::fe_l_rot_W</a>, <a class="el" href="data__bus_8h_source.html#l00064">DataBus::fe_r_pos_W</a>, <a class="el" href="data__bus_8h_source.html#l00067">DataBus::fe_r_rot_W</a>, <a class="el" href="data__bus_8h_source.html#l00106">DataBus::inertia</a>, <a class="el" href="data__bus_8h_source.html#l00109">DataBus::js_eul_des</a>, <a class="el" href="data__bus_8h_source.html#l00111">DataBus::js_omega_des</a>, <a class="el" href="data__bus_8h_source.html#l00110">DataBus::js_pos_des</a>, <a class="el" href="data__bus_8h_source.html#l00112">DataBus::js_vel_des</a>, <a class="el" href="data__bus_8h_source.html#l00172">DataBus::legState</a>, <a class="el" href="data__bus_8h_source.html#l00173">DataBus::legStateNext</a>, <a class="el" href="data__bus_8h_source.html#l00166">DataBus::LSt</a>, <a class="el" href="data__bus_8h_source.html#l00159">DataBus::phi</a>, <a class="el" href="data__bus_8h_source.html#l00050">DataBus::q</a>, and <a class="el" href="data__bus_8h_source.html#l00105">DataBus::slop</a>.</p>

</div>
</div>
<a id="a81bff1debd03ea83a56c85da5a70caf9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a81bff1debd03ea83a56c85da5a70caf9">&#9670;&nbsp;</a></span>dataBusWrite()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void MPC::dataBusWrite </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structDataBus.html">DataBus</a> &amp;&#160;</td>
          <td class="paramname"><em>Data</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>write date to data bus </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Data</td><td></td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="mpc_8cpp_source.html#l00453">453</a> of file <a class="el" href="mpc_8cpp_source.html">mpc.cpp</a>.</p>

<p class="reference">References <a class="el" href="data__bus_8h_source.html#l00130">DataBus::base_pos_des</a>, <a class="el" href="data__bus_8h_source.html#l00129">DataBus::base_rpy_des</a>, <a class="el" href="data__bus_8h_source.html#l00131">DataBus::des_ddq</a>, <a class="el" href="data__bus_8h_source.html#l00133">DataBus::des_delta_q</a>, <a class="el" href="data__bus_8h_source.html#l00132">DataBus::des_dq</a>, <a class="el" href="data__bus_8h_source.html#l00051">DataBus::dq</a>, <a class="el" href="data__bus_8h_source.html#l00121">DataBus::dX_cal</a>, <a class="el" href="data__bus_8h_source.html#l00122">DataBus::fe_react_tau_cmd</a>, <a class="el" href="data__bus_8h_source.html#l00144">DataBus::Fr_ff</a>, <a class="el" href="data__bus_8h_source.html#l00109">DataBus::js_eul_des</a>, <a class="el" href="data__bus_8h_source.html#l00111">DataBus::js_omega_des</a>, <a class="el" href="data__bus_8h_source.html#l00110">DataBus::js_pos_des</a>, <a class="el" href="data__bus_8h_source.html#l00112">DataBus::js_vel_des</a>, <a class="el" href="data__bus_8h_source.html#l00125">DataBus::qp_cpuTime_MPC</a>, <a class="el" href="data__bus_8h_source.html#l00124">DataBus::qp_nWSR_MPC</a>, <a class="el" href="data__bus_8h_source.html#l00126">DataBus::qpStatus_MPC</a>, <a class="el" href="data__bus_8h_source.html#l00120">DataBus::X_cal</a>, <a class="el" href="data__bus_8h_source.html#l00115">DataBus::X_cur</a>, and <a class="el" href="data__bus_8h_source.html#l00114">DataBus::Xd</a>.</p>

</div>
</div>
<a id="a39bcff9265cd0e14857c190cf42c418c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a39bcff9265cd0e14857c190cf42c418c">&#9670;&nbsp;</a></span>disable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void MPC::disable </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>disable <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> calculation </p>

<p class="definition">Definition at line <a class="el" href="mpc_8cpp_source.html#l00485">485</a> of file <a class="el" href="mpc_8cpp_source.html">mpc.cpp</a>.</p>

</div>
</div>
<a id="a01dcc1140862fcb030153849a9cb3ff9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a01dcc1140862fcb030153849a9cb3ff9">&#9670;&nbsp;</a></span>enable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void MPC::enable </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>enable <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> calculation </p>

<p class="definition">Definition at line <a class="el" href="mpc_8cpp_source.html#l00482">482</a> of file <a class="el" href="mpc_8cpp_source.html">mpc.cpp</a>.</p>

</div>
</div>
<a id="a23fc46fc8d12f89adad3c19035f93579"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a23fc46fc8d12f89adad3c19035f93579">&#9670;&nbsp;</a></span>get_ENA()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool MPC::get_ENA </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>get current <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> enable state </p>
<dl class="section return"><dt>Returns</dt><dd>true : <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> enable </dd>
<dd>
false : <a class="el" href="classMPC.html" title="This class implements the model predictive controller.">MPC</a> disable </dd></dl>

<p class="definition">Definition at line <a class="el" href="mpc_8cpp_source.html#l00489">489</a> of file <a class="el" href="mpc_8cpp_source.html">mpc.cpp</a>.</p>

</div>
</div>
<a id="a41574ac96dfd97c389bb6f9c1de01c06"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a41574ac96dfd97c389bb6f9c1de01c06">&#9670;&nbsp;</a></span>set_weight()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void MPC::set_weight </td>
          <td>(</td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>u_weight</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Eigen::MatrixXd&#160;</td>
          <td class="paramname"><em>L_diag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Eigen::MatrixXd&#160;</td>
          <td class="paramname"><em>K_diag</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the weight of cost function. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">u_weight</td><td>i.e. alpha, alpha * K is the weighted matrix of control input in cost fuction </td></tr>
    <tr><td class="paramname">L_diag</td><td>the diagonal of weighted matrix of state variable in cost function, should be row vector </td></tr>
    <tr><td class="paramname">K_diag</td><td>the diagonal of weighted matrix of control input in cost function, should be row vector </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="mpc_8cpp_source.html#l00074">74</a> of file <a class="el" href="mpc_8cpp_source.html">mpc.cpp</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="mpc_8h_source.html">mpc.h</a></li>
<li><a class="el" href="mpc_8cpp_source.html">mpc.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
